package cn.com.cetccst.datacenter.policy.entity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;

import java.util.Objects;

@Entity(tableName = BWAppEntity.TABLE_NAME, primaryKeys = {"packageName"})
public class BWAppEntity {
    public static final String TABLE_NAME = "black_white_app_entity";
    public static final int SOURCE_NONE = 0, SOURCE_STORE = 1, SOURCE_USER = 2, SOURCE_SYSTEM = 3;
    @ColumnInfo(name = "appSource")
    private int appSource = SOURCE_NONE;
    @ColumnInfo(name = "imgUrl")
    private String imgUrl;
    @NonNull
    @ColumnInfo(name = "packageName")
    private String packageName;
    @ColumnInfo(name = "name")
    private String name;
    @ColumnInfo(name = "versionName")
    private String versionName;
    @ColumnInfo(name = "description")
    private String description;
    @ColumnInfo(name = "size")
    private long size;
    @ColumnInfo(name = "white")
    private boolean white;
    @ColumnInfo(name = "appModelId")
    private String appModelId;
    @ColumnInfo(name = "appModelHash")
    private long appModelHash;

    public int getAppSource() {
        return appSource;
    }

    public void setAppSource(int appSource) {
        this.appSource = appSource;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersionName() {
        return versionName;
    }

    public void setVersionName(String versionName) {
        this.versionName = versionName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public boolean isWhite() {
        return white;
    }

    public void setWhite(boolean white) {
        this.white = white;
    }

    public String getAppModelId() {
        return appModelId;
    }

    public void setAppModelId(String appModelId) {
        this.appModelId = appModelId;
    }

    public long getAppModelHash() {
        return appModelHash;
    }

    public void setAppModelHash(long appModelHash) {
        this.appModelHash = appModelHash;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if (obj != null)
            return Objects.equals(getPackageName(), ((BWAppEntity) obj).getPackageName());
        return false;
    }
}
